* Set working directory
cd ""

*** Table 1: Descriptive Stats - Australia

clear
use "AU_cleaned.dta"

#delimit ;
sum combined_wp_social combined_rel_factor 
	combined_b5_ag b5_ag_altruism b5_ag_compliance 
	combined_b5_co b5_co_order b5_co_selfdiscipline 
	combined_b5_ex b5_ex_activity b5_ex_assertiveness 
	combined_b5_ne b5_ne_anxiety b5_ne_depression
	combined_b5_op  b5_op_aesthetics b5_op_ideas 
	income education age;
tab sex;
#delimit cr


*** Table 2: Correlations of social ideology, religiosity, and Big Five personality traits

clear
use "AU_cleaned.dta"

#delimit ;
pwcorr combined_wp_social combined_rel_factor, star(.05);
pwcorr combined_wp_social combined_b5_ag, star(.05);
pwcorr combined_wp_social combined_b5_co, star(.05);
pwcorr combined_wp_social combined_b5_ex, star(.05);
pwcorr combined_wp_social combined_b5_ne, star(.05);
pwcorr combined_wp_social combined_b5_op, star(.05);

pwcorr combined_rel_factor combined_b5_ag, star(.05);
pwcorr combined_rel_factor combined_b5_co, star(.05);
pwcorr combined_rel_factor combined_b5_ex, star(.05);
pwcorr combined_rel_factor combined_b5_ne, star(.05);
pwcorr combined_rel_factor combined_b5_op, star(.05);
#delimit cr

*** Table 3: Regression of social ideology on religiosity, personality, and demographics

clear
use "AU_cleaned.dta"

#delimit ;
foreach var of varlist combined_wp_social combined_rel_factor 
	combined_b5_ag
	combined_b5_co
	combined_b5_ex
	combined_b5_ne
	combined_b5_op
	age income education sex {;
		keep if `var'!=.;
	};
#delimit cr

#delimit ;
foreach var of varlist combined_wp_social combined_rel_factor 
	combined_b5_ag
	combined_b5_co
	combined_b5_ex
	combined_b5_ne
	combined_b5_op
	age income education {;
		qui sum `var';
		local mean=r(mean);
		local sd=r(sd);
		replace `var' = (`var'-`mean')/`sd';
	};
#delimit cr
	
#delimit ;
regress combined_wp_social 
	combined_rel_factor
	combined_b5_ag
	combined_b5_co
	combined_b5_ex
	combined_b5_ne
	combined_b5_op
	age income education sex, vce(cluster pairnumber);
#delimit cr


*** Table S1B: Descriptive Statistics by Gender - Australia

clear
use "AU_cleaned.dta"

* Women
#delimit ;
sum combined_wp_social combined_rel_factor 
	combined_b5_ag b5_ag_altruism b5_ag_compliance 
	combined_b5_co b5_co_order b5_co_selfdiscipline 
	combined_b5_ex b5_ex_activity b5_ex_assertiveness 
	combined_b5_ne b5_ne_anxiety b5_ne_depression
	combined_b5_op  b5_op_aesthetics b5_op_ideas 
	income education age if sex==0;
#delimit cr

* Men
#delimit ;
sum combined_wp_social combined_rel_factor 
	combined_b5_ag b5_ag_altruism b5_ag_compliance 
	combined_b5_co b5_co_order b5_co_selfdiscipline 
	combined_b5_ex b5_ex_activity b5_ex_assertiveness 
	combined_b5_ne b5_ne_anxiety b5_ne_depression
	combined_b5_op  b5_op_aesthetics b5_op_ideas 
	income education age if sex==1;
#delimit cr

*** Table S2: Regression results with Big Five facets (Australian component)

clear
use "AU_cleaned.dta"

#delimit ;
foreach var of varlist combined_wp_social combined_rel_factor 
	b5_ag_altruism b5_ag_compliance 
	b5_co_order b5_co_selfdiscipline 
	b5_ex_activity b5_ex_assertiveness 
	b5_ne_anxiety b5_ne_depression
	b5_op_aesthetics b5_op_ideas 
	income education age sex {;
		keep if `var'!=.;
	};
#delimit cr

#delimit ;
foreach var of varlist combined_wp_social combined_rel_factor 
	b5_ag_altruism b5_ag_compliance 
	b5_co_order b5_co_selfdiscipline 
	b5_ex_activity b5_ex_assertiveness 
	b5_ne_anxiety b5_ne_depression
	b5_op_aesthetics b5_op_ideas 
	income education age {;
		qui sum `var';
		local mean=r(mean);
		local sd=r(sd);
		replace `var' = (`var'-`mean')/`sd';
	};
#delimit cr
	
#delimit ;
regress combined_wp_social 
	combined_rel_factor
	b5_ag_altruism b5_ag_compliance 
	b5_co_order b5_co_selfdiscipline 
	b5_ex_activity b5_ex_assertiveness 
	b5_ne_anxiety b5_ne_depression
	b5_op_aesthetics b5_op_ideas 
	age income education sex, vce(cluster pairnumber);
#delimit cr

*** Table S3: MZ and DZ correlations (Australian component)

clear
use "AU_cleaned_pairs.dta"

local var1="combined_wp_social_"
local var2="combined_rel_factor_"
local var3="combined_b5_ag_"
local var4="b5_ag_altruism_"
local var5="b5_ag_compliance_"
local var6="combined_b5_co_"
local var7="b5_co_order_"
local var8="b5_co_selfdiscipline_"
local var9="combined_b5_ex_"
local var10="b5_ex_activity_"
local var11="b5_ex_assertiveness_"
local var12="combined_b5_ne_"
local var13="b5_ne_anxiety_"
local var14="b5_ne_depression_"
local var15="combined_b5_op_"
local var16="b5_op_aesthetics_" 
local var17="b5_op_ideas_"
local var18="income_"
local var19="education_"

foreach num of numlist 1/19 {
	qui corr `var`num''1 `var`num''2 if mz==1
	local mzcorr = r(rho)
	qui corr `var`num''1 `var`num''2 if mz==2
	local dzcorr = r(rho)
	display "`var`num'' `mzcorr' `dzcorr' "`mzcorr'/`dzcorr'
}





















* Set working directory

cd ""

*** Table 1: Descriptive stats - US

clear
use "US_cleaned.dta"


foreach var of varlist income education {
	qui sum `var'
	local min = r(min)
	local max = r(max)
	replace `var' = (`var'-`min')/(`max'-`min')
}

#delimit ;
sum wpscale_socialnorelig_2008 relig_combined 
	b5_ag b5_ag_altruism b5_ag_compliance 
	b5_co b5_co_order b5_co_selfdiscipline 
	b5_ex b5_ex_activity b5_ex_assertiveness 
	b5_ne b5_ne_anxiety b5_ne_depression
	b5_op b5_op_aesthetics b5_op_ideas 
	income education age;
tab rsex;
#delimit cr

*** Table 2: Correlations of social ideology, religiosity, and Big Five personality traits

clear
use "US_cleaned.dta"

#delimit ;
pwcorr wpscale_socialnorelig_2008 relig_combined, star(.05);
pwcorr wpscale_socialnorelig_2008 b5_ag, star(.05);
pwcorr wpscale_socialnorelig_2008 b5_co, star(.05);
pwcorr wpscale_socialnorelig_2008 b5_ex, star(.05);
pwcorr wpscale_socialnorelig_2008 b5_ne, star(.05);
pwcorr wpscale_socialnorelig_2008 b5_op, star(.05);

pwcorr relig_combined b5_ag, star(.05);
pwcorr relig_combined b5_co, star(.05);
pwcorr relig_combined b5_ex, star(.05);
pwcorr relig_combined b5_ne, star(.05);
pwcorr relig_combined b5_op, star(.05);
#delimit cr

*** Table 3: Regression of social ideology on religiosity, personality, and demographics

clear
use "US_cleaned.dta"

gen sex = rsex-1

#delimit ;
foreach var of varlist wpscale_socialnorelig_2008 relig_combined 
	b5_ag
	b5_co
	b5_ex
	b5_ne
	b5_op
	age income education sex {;
		keep if `var'!=.;
	};
#delimit cr

#delimit ;
foreach var of varlist wpscale_socialnorelig_2008 relig_combined 
	b5_ag
	b5_co
	b5_ex
	b5_ne
	b5_op
	age income education {;
		qui sum `var';
		local mean=r(mean);
		local sd=r(sd);
		replace `var' = (`var'-`mean')/`sd';
	};
#delimit cr
	
#delimit ;
regress wpscale_socialnorelig_2008 relig_combined 
	b5_ag
	b5_co
	b5_ex
	b5_ne
	b5_op
	age income education sex, vce(cluster pairnumber);
#delimit cr

*** Table S1A: Descriptive Statistics by Gender - United States

clear
use "US_cleaned.dta"

gen sex = rsex-1

foreach var of varlist income education {
	qui sum `var'
	local min = r(min)
	local max = r(max)
	replace `var' = (`var'-`min')/(`max'-`min')
}

* Women
#delimit ;
sum wpscale_socialnorelig_2008 relig_combined
	b5_ag b5_ag_altruism b5_ag_compliance 
	b5_co b5_co_order b5_co_selfdiscipline 
	b5_ex b5_ex_activity b5_ex_assertiveness 
	b5_ne b5_ne_anxiety b5_ne_depression
	b5_op  b5_op_aesthetics b5_op_ideas 
	income education age if sex==0;
#delimit cr

* Men
#delimit ;
sum wpscale_socialnorelig_2008 relig_combined
	b5_ag b5_ag_altruism b5_ag_compliance 
	b5_co b5_co_order b5_co_selfdiscipline 
	b5_ex b5_ex_activity b5_ex_assertiveness 
	b5_ne b5_ne_anxiety b5_ne_depression
	b5_op  b5_op_aesthetics b5_op_ideas 
	income education age if sex==1;
#delimit cr

*** Table S2: Regression results with Big Five facets

clear
use "US_cleaned.dta"

foreach var of varlist income education {
	qui sum `var'
	local min = r(min)
	local max = r(max)
	replace `var' = (`var'-`min')/(`max'-`min')
}

gen sex = rsex-1

#delimit ;
foreach var of varlist wpscale_socialnorelig_2008 relig_combined 
	b5_ag_altruism b5_ag_compliance 
	b5_co_order b5_co_selfdiscipline 
	b5_ex_activity b5_ex_assertiveness 
	b5_ne_anxiety b5_ne_depression
	b5_op_aesthetics b5_op_ideas 
	income education age sex {;
		keep if `var'!=.;
	};
#delimit cr

#delimit ;
foreach var of varlist wpscale_socialnorelig_2008 relig_combined 
	b5_ag_altruism b5_ag_compliance 
	b5_co_order b5_co_selfdiscipline 
	b5_ex_activity b5_ex_assertiveness 
	b5_ne_anxiety b5_ne_depression
	b5_op_aesthetics b5_op_ideas 
	income education age {;
		qui sum `var';
		local mean=r(mean);
		local sd=r(sd);
		replace `var' = (`var'-`mean')/`sd';
	};
#delimit cr
	
#delimit ;
regress wpscale_socialnorelig_2008 
	relig_combined 
	b5_ag_altruism b5_ag_compliance 
	b5_co_order b5_co_selfdiscipline 
	b5_ex_activity b5_ex_assertiveness 
	b5_ne_anxiety b5_ne_depression
	b5_op_aesthetics b5_op_ideas 
	age income education sex, vce(cluster pairnumber);
#delimit cr

*** Table S3: MZ and DZ correlations (US component)

* Set working directory

cd ""
clear
use "US_cleaned_pairs.dta"

local var1="wpscale_socialnorelig_2008_"
local var2="relig_combined_"
local var3="b5_ag_"
local var4="b5_ag_altruism_"
local var5="b5_ag_compliance_"
local var6="b5_co_"
local var7="b5_co_order_"
local var8="b5_co_selfdiscipline_"
local var9="b5_ex_"
local var10="b5_ex_activity_"
local var11="b5_ex_assertiveness_"
local var12="b5_ne_"
local var13="b5_ne_anxiety_"
local var14="b5_ne_depression_"
local var15="b5_op_"
local var16="b5_op_aesthetics_" 
local var17="b5_op_ideas_"
local var18="income_"
local var19="education_"

foreach num of numlist 1/19 {
	qui corr `var`num''1 `var`num''2 if mz==1
	local mzcorr = r(rho)
	qui corr `var`num''1 `var`num''2 if mz==2
	local dzcorr = r(rho)
	display "`var`num'' `mzcorr' `dzcorr' "`mzcorr'/`dzcorr'
}



